package cn.dianhun.om.jpa.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author cyt
 * @create 2020-07-07 14:04
 */
@Configuration
@Component
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(this.apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.dianhun.om.jpa"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo apiInfo() {
        @SuppressWarnings("deprecation")
        ApiInfo info = new ApiInfo(
                "Test Spring data jpa  Swagger",
                "study spring data jpa",
                "1.0",
                "study spring data jpa",
                "study spring data jpa",
                "Test Spring data jpa  Swagger",
                "Test Spring data jpa  Swagger");
        return info;
    }
}
